Operators
Operator Precedence
- Postfix: expr++, expr--
- Unary: ++expr, --expr, +expr, -expr, ~, !
- Multiplicative: *, /, %
- Additive: +, -
- Shift: <<, >>, >>>
- Relational: <, >, <=, >=, instanceof
- Equality: ==, !=
- Bitwise AND: &
- Bitwise XOR: ^
- Bitwise OR: |
- Logical AND: &&
- Logical OR: ||
- Ternary: ?:
- Assignment: =, +=, -=, *=, /=, %=, <<=, >>=, >>>=, &=, ^=, |=
instanceof
The instanceof
operator compares an object to a specified type. You can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements an interface.
When using the 'instanceof' operator, keep in mind that 'null' is not an instance of anything.